package com.demo.androidgame.finsternis;

import com.demo.androidgame.fx.Music;
import com.demo.androidgame.fx.Sound;
import com.demo.androidgame.fx.gl.Animation;
import com.demo.androidgame.fx.gl.Texture;
import com.demo.androidgame.fx.gl.TextureRegion;
import com.demo.androidgame.fx.impl.GLGame;

public class Assets {
	//메인화면 아래 숲 이미지
	public static Texture mainscreen;
	public static TextureRegion mainscreenRegion;
	//스테이지 보여주는 전체 화면
	public static Texture stagemap;
	public static TextureRegion stagemapRegion;
	//스토리 보여주는 화면
	public static Texture story;
	public static TextureRegion storyRegion;
	
	
	public static Texture platformArray;
	public static TextureRegion platform1;
	public static TextureRegion platform2;
	public static TextureRegion platform3;
	public static TextureRegion platform4;
	public static TextureRegion platform5;
	public static TextureRegion dummyplatform1;
	public static TextureRegion dummyplatform2;
	public static TextureRegion dummyplatform3;
	public static TextureRegion dummyplatform4;
	public static TextureRegion dummyplatform5;
	
	public static Texture gate;
	public static TextureRegion tomb;
	public static TextureRegion teleportIn;
	public static TextureRegion door;
	public static TextureRegion teleportOut;
	
	//스테이지 1 배경
	public static Texture lastbackground;
	public static TextureRegion lastbg1; 
	public static TextureRegion lastbg2; 
	public static TextureRegion lastbg3; 
	public static TextureRegion lastbg4; 
	public static TextureRegion lastbg5; 
	public static TextureRegion lastbg6; 
	public static TextureRegion lastbg7; 
	public static TextureRegion lastbg8;
	
	public static Texture frontbackground;
	public static TextureRegion frontbg1;
	public static TextureRegion frontbg2; 
	public static TextureRegion frontbg3; 
	public static TextureRegion frontbg4; 
	public static TextureRegion frontbg5; 
	public static TextureRegion frontbg6; 
	public static TextureRegion frontbg7; 
	public static TextureRegion frontbg8;
    
    
    
    public static Texture mainscreenmenu;
    public static TextureRegion start;
    public static TextureRegion credit;
    public static TextureRegion manual;
    public static TextureRegion soundon;
    public static TextureRegion soundoff;
    
    public static Texture stagenumber;
    public static TextureRegion stagenum1;
    public static TextureRegion stagenum2;
    public static TextureRegion stagenum3;
    public static TextureRegion stagenum4;
    public static TextureRegion stagenum5;
    public static TextureRegion stagenum6;
    public static TextureRegion stagenum7;
    public static TextureRegion stagenum8;
    public static TextureRegion stagenum9;
    public static TextureRegion back;
    
    public static Texture run;
    public static Animation bobrun; 
    public static Texture jump;
    public static Animation bobjump; 
    public static TextureRegion pause;
    //////////////////////////////////////////////
    public static Texture gamefont;
    public static TextureRegion resume;
    public static TextureRegion reStart;
    public static TextureRegion mainMenu;
    public static TextureRegion stageSelect;
    public static TextureRegion ready;
    public static TextureRegion gameOver;
    public static TextureRegion clear;
    
    public static TextureRegion zero;
    public static TextureRegion one;
    public static TextureRegion two;
    public static TextureRegion three;
    public static TextureRegion four;
    public static TextureRegion five;
    public static TextureRegion six;
    public static TextureRegion seven;
    public static TextureRegion eight;
    public static TextureRegion nine;
    
    public static TextureRegion zero_r;
    public static TextureRegion one_r;
    public static TextureRegion two_r;
    public static TextureRegion three_r;
    public static TextureRegion four_r;
    public static TextureRegion five_r;
    public static TextureRegion six_r;
    public static TextureRegion seven_r;
    public static TextureRegion eight_r;
    public static TextureRegion nine_r;
    /////////////////////////////////////////////
    public static Music gameMusic;
    public static Music mainMusic;
    public static Sound doorSound;
    public static Sound gameoverSound;
    public static Sound jumpSound;
    public static Sound teleportSound;
    public static Sound clickSound;
    
    public static void load(GLGame game) {
    	mainscreen = new Texture(game, "mainscreen.png");
    	mainscreenRegion = new TextureRegion(mainscreen, 0, 0, 480, 320);
    	
    	stagemap = new Texture(game, "stagemap1.png");
    	stagemapRegion = new TextureRegion(stagemap, 0, 0, 500, 350);
    	
    	story = new Texture(game, "story.png");
    	storyRegion = new TextureRegion(story, 0, 0, 480, 320);
    	
    	lastbackground = new Texture(game, "layer1.png");
    	lastbg1 = new TextureRegion(lastbackground, 0, 0, 480, 320);
    	lastbg2 = new TextureRegion(lastbackground, 480, 0, 480, 320);
    	lastbg3 = new TextureRegion(lastbackground, 960, 0, 480, 320);
    	lastbg4 = new TextureRegion(lastbackground, 1440, 0, 480, 320);
    	lastbg5 = new TextureRegion(lastbackground, 1760, 0, 480, 320);
    	lastbg6 = new TextureRegion(lastbackground, 2080, 0, 480, 320);
    	lastbg7 = new TextureRegion(lastbackground, 2400, 0, 480, 320);
    	
    	frontbackground = new Texture(game, "layer3.png");
    	frontbg1 = new TextureRegion(frontbackground, 0, 0, 480, 320);
    	frontbg2 = new TextureRegion(frontbackground, 480, 0, 480, 320);
    	frontbg3 = new TextureRegion(frontbackground, 960, 0, 480, 320);
    	frontbg4 = new TextureRegion(frontbackground, 1440, 0, 480, 320);
    	frontbg5 = new TextureRegion(frontbackground, 1760, 0, 480, 320);
    	frontbg6 = new TextureRegion(frontbackground, 2080, 0, 480, 320);
    	frontbg7 = new TextureRegion(frontbackground, 2400, 0, 480, 320);
    	
    	platformArray = new Texture(game, "platform.png");
    	platform1 = new TextureRegion(platformArray, 0, 0, 32, 32);
    	platform2 = new TextureRegion(platformArray, 32, 0, 32, 32);
    	platform3 = new TextureRegion(platformArray, 64, 0, 32, 32);
    	platform4 = new TextureRegion(platformArray, 96, 0, 32, 32);
    	platform5 = new TextureRegion(platformArray, 128, 0, 32, 32);
    	dummyplatform1 = new TextureRegion(platformArray, 0, 32, 32, 32);
    	dummyplatform2 = new TextureRegion(platformArray, 32, 32, 32, 32);
    	dummyplatform3 = new TextureRegion(platformArray, 64, 32, 32, 32);
    	dummyplatform4 = new TextureRegion(platformArray, 96, 32, 32, 32);
    	dummyplatform5 = new TextureRegion(platformArray, 128, 32, 32, 32);
    	
    	gate = new Texture(game, "game_item.png");
    	tomb = new TextureRegion(gate, 64, 0, 32, 32);	//!
    	teleportIn = new TextureRegion(gate, 32, 0, 32, 32);
    	door = new TextureRegion(gate, 0, 0, 32, 32);
    	teleportOut = new TextureRegion(gate, 96, 0, 32, 32);
    	
        
    	
    	
    	mainscreenmenu = new Texture(game, "mainscreenfont.png");
        start = new TextureRegion(mainscreenmenu, 0, 0, 92, 26);
        credit = new TextureRegion(mainscreenmenu, 0, 26, 104, 26);
        manual = new TextureRegion(mainscreenmenu, 0, 55, 126, 26);
        soundon = new TextureRegion(mainscreenmenu, 0, 83, 100, 26);
        soundoff = new TextureRegion(mainscreenmenu, 0, 112, 100, 26);
        
        
        stagenumber = new Texture(game, "stagenumber1.png");
        stagenum1 = new TextureRegion(stagenumber, 0, 0, 64, 64);
        stagenum2 = new TextureRegion(stagenumber, 64, 0, 64, 64);
        stagenum3 = new TextureRegion(stagenumber, 128, 0, 64, 64);
        stagenum4 = new TextureRegion(stagenumber, 192, 0, 64, 64);
        stagenum5 = new TextureRegion(stagenumber, 256, 0, 64, 64);
        stagenum6 = new TextureRegion(stagenumber, 320, 0, 64, 64);
        stagenum7 = new TextureRegion(stagenumber, 388, 0, 64, 64);
        stagenum8 = new TextureRegion(stagenumber, 457, 0, 64, 64);
        stagenum9 = new TextureRegion(stagenumber, 526, 0, 64, 64);
        back = new TextureRegion(stagenumber, 592, 0, 64, 64);
        
        gamefont = new Texture(game, "gamefont.png");
        resume = new TextureRegion(gamefont, 0, 0, 128, 40);
        reStart = new TextureRegion(gamefont, 128, 0, 146, 40);
        mainMenu = new TextureRegion(gamefont, 274, 0, 178, 40);
        stageSelect = new TextureRegion(gamefont, 0, 38, 200, 40);
        ready = new TextureRegion(gamefont, 200, 38, 182, 40);
        gameOver = new TextureRegion(gamefont, 0, 78, 310, 40);
        pause = new TextureRegion(gamefont, 310, 78, 40, 40);
        clear = new TextureRegion(gamefont, 0, 118, 215, 40);
        
        
        zero = new TextureRegion(gamefont, 0, 160, 19, 27);
        one = new TextureRegion(gamefont, 19, 160, 18, 27);
        two = new TextureRegion(gamefont, 37, 160, 18, 27);
        three = new TextureRegion(gamefont, 55, 160, 18, 27);
        four = new TextureRegion(gamefont, 73, 160, 18, 27);
        five = new TextureRegion(gamefont, 91, 160, 18, 27);
        six = new TextureRegion(gamefont, 109, 160, 18, 27);
        seven = new TextureRegion(gamefont, 127, 160, 20, 27);
        eight = new TextureRegion(gamefont, 148, 160, 19, 27);
        nine = new TextureRegion(gamefont, 167, 160, 18, 27);
        
        zero_r = new TextureRegion(gamefont, 0, 190, 19, 27);
        one_r = new TextureRegion(gamefont, 19, 190, 18, 27);
        two_r = new TextureRegion(gamefont, 37, 190, 18, 27);
        three_r = new TextureRegion(gamefont, 55, 190, 18, 27);
        four_r = new TextureRegion(gamefont, 73, 190, 18, 27);
        five_r = new TextureRegion(gamefont, 91, 190, 18, 27);
        six_r = new TextureRegion(gamefont, 109, 190, 18, 27);
        seven_r = new TextureRegion(gamefont, 127, 190, 20, 27);
        eight_r = new TextureRegion(gamefont, 148, 190, 19, 27);
        nine_r = new TextureRegion(gamefont, 167, 190, 18, 27);
        
        run = new Texture(game, "run.png");
        bobrun = new Animation(0.3f,
                                new TextureRegion(run, 0, 0, 32, 32),
                                new TextureRegion(run, 32, 0, 32, 32),
                                new TextureRegion(run, 64, 0, 32, 32));
        
        jump = new Texture(game, "jump.png");
        bobjump = new Animation(0.2f,
                                new TextureRegion(jump, 0, 0, 32, 32),
                                new TextureRegion(jump, 32, 0, 32, 32));
        
        
        gameMusic = game.getAudio().newMusic("finsternis_gamebg.mp3");
        gameMusic.setLooping(true);
        gameMusic.setVolume(0.5f);
        if(Settings.soundEnabled)
        	gameMusic.play();
        mainMusic = game.getAudio().newMusic("finsternis_main.mp3");
        mainMusic.setLooping(true);
        mainMusic.setVolume(0.2f);
        if(Settings.soundEnabled)
        	mainMusic.play();
        jumpSound = game.getAudio().newSound("finsternis_jump.mp3");
        teleportSound = game.getAudio().newSound("finsternis_teleport.mp3");
        gameoverSound = game.getAudio().newSound("finsternis_gameover.mp3");
        doorSound = game.getAudio().newSound("finsternis_door.mp3");
        clickSound = game.getAudio().newSound("finsternis_click.mp3");    
    }       
    
    public static void reload() {
    	mainscreen.reload();
    	mainscreenmenu.reload();
        run.reload();
        jump.reload();
        if(Settings.soundEnabled)
            gameMusic.play();
        if(Settings.soundEnabled)
            mainMusic.play();
    }
    
    public static void playSound(Sound sound) {
        if(Settings.soundEnabled)
            sound.play(0.3f);
    }
}
